package com.briup.mt.web.controller;

import com.briup.mt.bean.Counsel;
import com.briup.mt.bean.Dataset;
import com.briup.mt.service.ICounselService;
import com.briup.mt.utils.ExcelUtils;
import com.briup.mt.utils.Message;
import com.briup.mt.utils.MessageUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/counsel")
@Validated

public class CounselController {
    @Autowired
    private ICounselService counselService;


    @GetMapping("query")
    public Message query(String question,String replay,String status){
        List<Counsel>list=counselService.query(question,replay,status);
        return MessageUtil.success(list);
    }
    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(Counsel counsel){
        counselService.saveOrUpdate(counsel);
        return MessageUtil.success("操作成功");

    }

    @DeleteMapping("deleteById")


    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "类别编号", required = true, paramType = "query"),
    })
    public Message deleteById(@NotNull Long id){
        counselService.deleteById(id);
        return MessageUtil.success("删除成功");
    }
}




